home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / lists / mint / l_1599 / 1587 < prev    next >
Encoding:
Internet Message Format  |  1994-08-27  |  2.9 KB

  1. From: Stephen Usher <Stephen.Usher@earth.ox.ac.uk>
  2. Subject: Re: Virtual memory and MiNT
  3. Date: Thu, 23 Jun 1994 17:03:24 +0100 (BST)
  4. In-Reply-To: <Pine.3.85.9406231554.A2539-0100000@cyber.proxxi.uf.se> from "Elias M}rtensson" at Jun 23, 94 03:32:02 pm
  5. Mime-Version: 1.0
  6.  
  7. >On Thu, 23 Jun 1994, Pereira Martins wrote:
  8. >
  9. >> Yes, of course. But I'm not the one to do this, because I don't know
  10. >> how virtual memory driver works :-(
  11. >> Sorry.
  12. >
  13. >Well, I'm looking in to it right now, and we'll see how it comes out...
  14. >
  15. >My way of doing it is to let the kernel allocate say, 3MB of buffer, then
  16. >map the first 3 megabytes of TT-ram into this buffer. Then, the bus-error 
  17. >handler has to handle the swapping of the other memory.
  18. >
  19. >Now, I wonder if anybody can expain to me the existance of the MMAP swap 
  20. >in mem.c. The way I do it the alt memory map is actually the swap memory 
  21. >map. Is there another good way of doing this?
  22.  
  23. Another way, the way that BSD style Unix's do it is what's known as demand
  24. paging.
  25.  
  26. When a program is started the space for it is allocated in the swap
  27. partition/file, the memory manager's tables are set up so that all the pages
  28. of memory are set to be owned by the process but not allocated. The
  29. program's then started, immediately causing a page fault as the text page
  30. isn't currently in memory. From then on pages are only loaded into main
  31. memory when they are accessed. When all the physical memory has been used up
  32. by pages which have been loaded in pages have to be written out to disk
  33. before the memory page (usually 8K bytes in size) can be reused by the new
  34. page of memory. Paging out algorithms are tricky to get right for optimum
  35. speed efficiency.
  36.  
  37. Usually the stack pointer for a process is placed right at the top of the
  38. virtual memory map and the text etc. placed near the bottom, the stack can
  39. then grow dynamically downward without hitting the code.
  40.  
  41. All processes start with at the same virtual base address so sharing text is
  42. incredibly easy to do, you merely map the text pages into the same address
  43. range for all processes. This also makes a true fork() easy as you merely
  44. clone the memory manager tables except that you mark all the pages to be
  45. copied upon the first write access (ie. make them read-only but mark them
  46. (in one of the translation table's unused bytes) so that when you get an
  47. access violation the original contents are cloned into a new page) and clone
  48. the stack pages, both processes, the parent and child, can now be run
  49. without problems.
  50.  
  51. >-- 
  52. >Elias M}rtenson                   !  No joke here.
  53. >elias@proxxi.uf.se                !  Sorry for the inconvenience.
  54. >C-programmerare och GNU-fanatiker ! 
  55.  
  56. Steve
  57.  
  58. -- 
  59. ---------------------------------------------------------------------------
  60. Computer Systems Administrator, Dept. of Earth Sciences, Oxford University.
  61. E-Mail: steve@uk.ac.ox.earth (JANET) steve@earth.ox.ac.uk (Internet).
  62. Tel:- Oxford (0865) 282110 (UK) or +44 865 282110 (International).
  63.